// *** ADDED BY HEADER FIXUP ***
#include <algorithm>
#include <string>
// *** END ***
 /*----------------------------------*/
#include "Email.h"
/*----------------------------------*/
Email::Email(string email)
{
    setValor(email);
}

void Email::validar(string email)
{
    EmailsValidos validados;
    validados.setValidos();
    size_t found = email.find_first_of("@");
    if(found!=string::npos)
    {
        unsigned int flag = 0,i=0;
        string sub = email.substr(found,email.size());
        if(email.size()<3)
        {
            throw invalid_argument("E-mail invalido.");
        }
        if(!(validados.pesquisar(sub)))
        {
            throw invalid_argument("E-mail invalido.");
        }
    }
    else
        throw invalid_argument("E-mail invalido.");
}
